/**
 *demo 用户管理页面
 *
 */
Ext.define("app.controller.demo.UserController", {
    extend: "Ext.app.Controller",
    stores: ["demo.Users", "demo.Menus"],
    models: ["demo.User", "demo.Menu"],
    views: ["demo.UserList"],

    init: function () {
        this.control({
            "#userList": {
                beforerender: function (e) {
                    //查询权限加载按钮
                    Ext.Ajax.request({
                        url: JS_PATH + "js/app/data/buttons.json",
                        success: function (response, opts) {
                            var obj = Ext.decode(response.responseText);
                            if(obj.userList){
                                loadButtons(e, "userList_grid", obj.userList);
                            }
                        },
                        failure: function (response, opts) {
                            Ext.Msg.alert("提示", "加载失败");
                        }
                    });
                },
            },
            "#btnAdd": {
                click: this.btnAddClick
            },
            "#btnEdit": {
                click: this.btnAddClick
            },
        });
    },
    btnAddClick: function () {
        Ext.Msg.alert("提示", "ddddd");
    }
});
